#ifndef TIMELINEVIEW_H
#define TIMELINEVIEW_H

#include <QWidget>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QLabel>

#include <QPushButton>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QThread>

#include "mobilefilelistview.h"
#include "timelinelistwidget.h"
#include "arrowlinebutton.h"
#include "fileinfo.h"

//所有时间线标题和图片
class TimeLineView : public QWidget
{
    Q_OBJECT
public:
    TimeLineView(int itemName, QWidget *parent = nullptr);
    ~TimeLineView();

    enum LIST_TYPE {QQPICTURE, QQVIDEO, QQMUSIC, QQDOCUMENT, WECHATPICTURE,
                    WECHATVIDEO, WECHATMUSIC, WECHATDOCUMENT,
                    PICTURE, VIDEO, MUSIC, DOCUMENT};

    //设置列表模式
    void setMode(QListView::ViewMode mode);
    void setCurrentViewMode(int currentIndex);
    void setTimeLineData(const QList<FileInfo> &listStruct);
    void setData(const QList<FileInfo> &listStruct);
    //插入图片数据
    void setPictureTimeLineDateWidget();
    //插入音乐数据
    void setMusicDateWidget();
    //插入文档数据
    void setDocumentDateWidget();
    void setThumbnail(QString fileName);
public Q_SLOTS:

Q_SIGNALS:
    //    void signalSelectCurrentDate(bool);
    void signalViewModeFlag(QListView::ViewMode mode);
    void sigItemInitFinish();

    void sigShowCopyButton();
    void sigHideCopyToComputerWidget();
    void sigSelectDataList(const QList<FileInfo> &fileList);
    void sigSelectAllDataList(const QList<FileInfo> &fileList);
    void sigMenuFilePath(QString filePath);
private Q_SLOTS:
    //显示复制按钮
    void slotShowCopyButton();
    //隐藏复制按钮
    void slotHideCopyToComputerWidget();
    //选中的数据列表
    void slotSelectDataList(const QList<FileInfo> &fileList);
    //滑动条的滑块改变
    void slotValueChanged(int value);

private:
    //图片 视频
    void initTimeLineViewWidget();
    //音乐 文档
    void initViewWidget();
    //更新复选框的状态
    void updateCheckBox();
    //设置视频或图片项数据
    void setTimeLineData();

private:
    //所有的时间线
    QList<QString> m_allPictureTimeLine;
    //所有时间线的照片
    QList<QList<FileInfo>> m_allTimeLinePicture;
    //图片
    QLabel *m_pictureDate = nullptr;
    QLabel *m_pictureNum = nullptr;
    int m_currentPictureTimeLineLoad = 0;
    TimeLineListWidget *m_pictureListWidget = nullptr;
    QList<MobileFileListView *> m_allPictureListView;
    QList<QCheckBox *> m_allPictureCheckBox;
    QList<ArrowLineButton *> m_allPictureArrowLineButton;
    int m_lastPictureChickedIndex = 0;
    QList<int> m_allPictureAllow;

    QList<FileInfo> m_listStruct;
    QMap<QString, QStandardItem *> m_itemMap;
    //当前所在界面
    int m_itemName;
    int m_lastClickedIndex = 0;
    int m_lastRow = -1;
    bool m_lastChanged = false;
    bool m_ctrlPress = false;
    int m_startCount = 0;
    int m_endCount = 0;
    //默认Icon = 0
    int m_currentViewMode = 0;
};

#endif // TIMELINEVIEW_H
